#pragma once
#include <zMat.hpp>

namespace zzz{
class NonlinearSystem
{
public:
  NonlinearSystem(int n_var, int n_cons):nVar_(n_var),nConstraints_(n_cons){}
  int nVar_;
  int nConstraints_;

  virtual void Initialize(zVector<double> &init_x)=0;
  virtual void WriteBack(const zVector<double> &result_x)=0;
  virtual void CalculateResidue(double *residue, const double *x)=0;
  //jac is nConstraints*nVar
  virtual void CalculateJacobian(zMatrixBaseW<double,zColMajor> &jac, const double *x)=0;
};

class NonlinearSystemSolver
{
public:
  virtual int Solve(NonlinearSystem &sys)=0;
};
}